
<?php
date_default_timezone_set('Asia/Bangkok');
get_header();
?>
<form id="homeform">
    <div class="row main-block">
        <div class="col-md-5 block-new block-style-two cat-0">
            <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar("Home left")) : endif; ?>
        </div>
        <div class="col-md-7 p0">
            <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar("Home right")) : endif; ?>
        </div>
    </div>
</form>
<script type="text/javascript">
    jQuery(document).ready(function() {

        /*run when load*/
        convertTimetoString();
        getTotalCountFB();
        setInterval(function() {
            getnewsf5();
            convertTimetoString();
            getTotalCountFB();
        }, 5000);
        function getnewsf5() {
            jQuery('.cat-0 p.countf5').text('...');
            jQuery.ajax({
                type: 'POST',
                url: '<?php echo home_url('wp-content/themes/tinf5/getf5.php') ?>',
                dataType: 'json',
                success: function(response) {
                    if ((typeof (response) !== 'undefined') && (response !== null)) {
                        jQuery('.cat-0 p.countf5').text(response.count);
                        var lastID = jQuery('#lastpostID').val();
                        if (lastID != response.lastid) {
                            jQuery('.cat-0 .newslist').prepend(response.news);
                            jQuery('#lastpostID').val(response.lastid);
                            jQuery('title').text(response.title);
                            jBeep('<?php echo home_url('wp-content/themes/tinf5/images/icon/sound.mp3'); ?>');
                        }
                    }
                }
            });
        }

        /*show / hide category*/
        jQuery('.btn-shcate, .block-new h3').click(function() {
            jQuery(this).parent().siblings('.contentblock').toggle("slow");
        });
    })

</script>
<?php get_footer(); ?>
